import 'package:cbec_app/generated/json/base/json_field.dart';
import 'package:cbec_app/generated/json/topic_product_entity.g.dart';
import 'dart:convert';

import 'content_data.dart';

@JsonSerializable()
class TopicProductEntity extends ContentData {
  @JSONField(name: "display_scale")
  String? displayScale = '';
  @JSONField(name: "price_qz")
  String? priceQz = '';
  @JSONField(name: "mask_color")
  String? maskColor = '';
  List<TopicProductGoods>? goods = [];
  @JSONField(name: "text_align_type")
  String? textAlignType = '';
  @JSONField(name: "bg_image")
  TopicProductBgImage? bgImage;
  String? uuid = '';
  @JSONField(name: "page_margin_bottom_2")
  int? pageMarginBottom2 = 0;
  @JSONField(name: "bg_color2")
  String? bgColor2 = '';
  @JSONField(name: "default_goods")
  List<TopicProductDefaultGoods>? defaultGoods = [];
  bool? price = false;
  @JSONField(name: "bg_color5")
  String? bgColor5 = '';
  @JSONField(name: "goods_margin_top")
  int? goodsMarginTop = 0;
  @JSONField(name: "page_margin_right")
  int? pageMarginRight = 0;
  @JSONField(name: "sub_entry")
  List<TopicProductSubEntry>? subEntry = [];
  @JSONField(name: "goods_margin_left_2")
  int? goodsMarginLeft2 = 0;
  double? per;
  @JSONField(name: "img_top")
  double? imgTop;
  bool? bottomrds = false;
  @JSONField(name: "page_margin_bottom")
  int? pageMarginBottom = 0;
  @JSONField(name: "size_type")
  String? sizeType = '';
  @JSONField(name: "page_margin_top_2")
  int? pageMarginTop2 = 0;
  @JSONField(name: "border_radius_type")
  String? borderRadiusType = '';
  @JSONField(name: "show_sold_num")
  bool? showSoldNum = false;
  @JSONField(name: "oldprice_color")
  String? oldpriceColor = '';
  @JSONField(name: "text_align_type2")
  String? textAlignType2 = '';
  @JSONField(name: "show_title")
  bool? showTitle = false;
  @JSONField(name: "sub_text")
  String? subText = '';
  @JSONField(name: "more_text")
  String? moreText = '';
  @JSONField(name: "page_margin_top")
  int? pageMarginTop = 0;
  @JSONField(name: "show_origin_price")
  bool? showOriginPrice = false;
  @JSONField(name: "show_hd")
  bool? showHd = false;
  TopicProductLink? link;
  @JSONField(name: "image_fill_style")
  String? imageFillStyle = '';
  @JSONField(name: "corner_mark_type")
  String? cornerMarkType = '';
  @JSONField(name: "show_corner_mark")
  bool? showCornerMark = false;
  @JSONField(name: "image_fill_style2")
  String? imageFillStyle2 = '';
  @JSONField(name: "mtitle_color")
  String? mtitleColor = '';
  @JSONField(name: "text_style_type")
  String? textStyleType = '';
  @JSONField(name: "link_more")
  TopicProductLinkMore? linkMore;
  @JSONField(name: "image_fill_style8")
  String? imageFillStyle8 = '';
  @JSONField(name: "hd_image2")
  TopicProductHdImage2? hdImage2;
  @JSONField(name: "hd_image")
  TopicProductHdImage? hdImage;
  @JSONField(name: "show_more")
  bool? showMore = false;
  @JSONField(name: "goods_margin_iner")
  int? goodsMarginIner = 0;
  @JSONField(name: "sold_color")
  String? soldColor = '';
  @JSONField(name: "title_color")
  String? titleColor = '';
  @JSONField(name: "page_margin_top5")
  int? pageMarginTop5 = 0;
  int? bdr5 = 0;
  @JSONField(name: "price_color")
  String? priceColor = '';
  @JSONField(name: "goods_margin")
  int? goodsMargin = 0;
  @JSONField(name: "page_margin_left")
  int? pageMarginLeft = 0;
  int? bdr = 0;
  @JSONField(name: "bg_color")
  String? bgColor = '';
  @JSONField(name: "goods_margin_left")
  int? goodsMarginLeft = 0;
  @JSONField(name: "main_text")
  String? mainText = '';
  @JSONField(name: "corner_mark_image")
  String? cornerMarkImage = '';
  bool? soldzero = false;

  TopicProductEntity() {
    type = 'topicitems';
  }

  factory TopicProductEntity.fromJson(Map<String, dynamic> json) => $TopicProductEntityFromJson(json);

  @override
  Map<String, dynamic> toJson() => $TopicProductEntityToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }

  @override
  ContentData fromJson(Map<String, dynamic> json) {
    return TopicProductEntity.fromJson(json);
  }
}

@JsonSerializable()
class TopicProductGoods {
  int? isCombination = 0;
  int? commoditySource = 0;
  String? className = '';
  double? priceMarket;
  int? secondClassID = 0;
  int? baseSpec = 0;
  int? number = 0;
  int? classId = 0;
  int? commodityStatus = 0;
  double? price;
  double? highPrice;
  String? id = '';
  String? supplierName = '';
  dynamic image;
  String? brandName = '';
  dynamic paySingle;
  int? priceType = 0;
  List<TopicProductGoodsSpecList>? specList = [];
  int? firstClassID = 0;
  String? commodityId = '';
  dynamic sort;
  int? commodityType = 0;
  String? barCode = '';
  String? spuSpecJsonBody = '';
  double? taxRate;
  String? mainImage = '';
  double? priceCost;
  List<dynamic>? discountLabel = [];
  int? commodityForm = 0;
  int? brandId = 0;
  double? highTaxRate;
  String? skuCode = '';
  String? commodityName = '';
  int? status = 0;

  TopicProductGoods();

  factory TopicProductGoods.fromJson(Map<String, dynamic> json) => $TopicProductGoodsFromJson(json);

  Map<String, dynamic> toJson() => $TopicProductGoodsToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class TopicProductGoodsSpecList {
  double? taxRate;
  double? priceCost;
  int? specNum = 0;
  double? price;
  double? highPrice;
  double? priceMarket;
  double? profit;

  TopicProductGoodsSpecList();

  factory TopicProductGoodsSpecList.fromJson(Map<String, dynamic> json) => $TopicProductGoodsSpecListFromJson(json);

  Map<String, dynamic> toJson() => $TopicProductGoodsSpecListToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class TopicProductBgImage {
  @JSONField(name: "attachment_url")
  String? attachmentUrl = '';

  TopicProductBgImage();

  factory TopicProductBgImage.fromJson(Map<String, dynamic> json) => $TopicProductBgImageFromJson(json);

  Map<String, dynamic> toJson() => $TopicProductBgImageToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class TopicProductDefaultGoods {
  String? image = '';
  String? price = '';
  List<TopicProductDefaultGoodsSpecList>? specList = [];
  int? id = 0;
  int? saleNum = 0;
  String? commodityName = '';

  TopicProductDefaultGoods();

  factory TopicProductDefaultGoods.fromJson(Map<String, dynamic> json) => $TopicProductDefaultGoodsFromJson(json);

  Map<String, dynamic> toJson() => $TopicProductDefaultGoodsToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class TopicProductDefaultGoodsSpecList {
  int? price = 0;
  int? priceMarket = 0;

  TopicProductDefaultGoodsSpecList();

  factory TopicProductDefaultGoodsSpecList.fromJson(Map<String, dynamic> json) => $TopicProductDefaultGoodsSpecListFromJson(json);

  Map<String, dynamic> toJson() => $TopicProductDefaultGoodsSpecListToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class TopicProductSubEntry {
  @JSONField(name: "link_type")
  String? linkType = '';
  @JSONField(name: "image_url")
  String? imageUrl = '';
  @JSONField(name: "link_title")
  String? linkTitle = '';
  String? title = '';
  @JSONField(name: "link_id")
  String? linkId = '';
  String? desc = '';

  TopicProductSubEntry();

  factory TopicProductSubEntry.fromJson(Map<String, dynamic> json) => $TopicProductSubEntryFromJson(json);

  Map<String, dynamic> toJson() => $TopicProductSubEntryToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class TopicProductLink {
  @JSONField(name: "link_type")
  String? linkType = '';
  @JSONField(name: "link_title")
  String? linkTitle = '';
  @JSONField(name: "link_id")
  String? linkId = '';

  TopicProductLink();

  factory TopicProductLink.fromJson(Map<String, dynamic> json) => $TopicProductLinkFromJson(json);

  Map<String, dynamic> toJson() => $TopicProductLinkToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class TopicProductLinkMore {
  @JSONField(name: "link_type")
  String? linkType = '';
  @JSONField(name: "link_title")
  String? linkTitle = '';
  @JSONField(name: "link_id")
  String? linkId = '';

  TopicProductLinkMore();

  factory TopicProductLinkMore.fromJson(Map<String, dynamic> json) => $TopicProductLinkMoreFromJson(json);

  Map<String, dynamic> toJson() => $TopicProductLinkMoreToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class TopicProductHdImage2 {
  @JSONField(name: "attachment_url")
  String? attachmentUrl = '';

  TopicProductHdImage2();

  factory TopicProductHdImage2.fromJson(Map<String, dynamic> json) => $TopicProductHdImage2FromJson(json);

  Map<String, dynamic> toJson() => $TopicProductHdImage2ToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class TopicProductHdImage {
  @JSONField(name: "attachment_url")
  String? attachmentUrl = '';

  TopicProductHdImage();

  factory TopicProductHdImage.fromJson(Map<String, dynamic> json) => $TopicProductHdImageFromJson(json);

  Map<String, dynamic> toJson() => $TopicProductHdImageToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}
